package kafkaMdw

import (
	"context"
	"fmt"
	"github.com/segmentio/kafka-go"
	"log"
)

func Consumer() {
	reader := kafka.NewReader(kafka.ReaderConfig{
		Brokers:   []string{"localhost:9092"},
		Topic:     "chris-topic",
		Partition: 0,
		MinBytes:  10e3,
		MaxBytes:  10e6,
	})
	defer reader.Close()

	for {
		message, err := reader.ReadMessage(context.Background())
		if err != nil {
			log.Fatalln(err)
		}
		fmt.Println(string(message.Value))
	}

}
